#ifndef __GlSprite_h__
#define __GlSprite_h__

#include "GlGraphicComponent.h"
#include "GlMain.h"

namespace GraphicLibrary
{
	class Position;
	class Size;

	class GlExport Sprite
		: public virtual GraphicComponent
	{
		protected:
			class Factory
			{
				public:
					virtual ~Factory();
					virtual Sprite* create(const char *spriteName) = 0;
			};
		public:
			virtual void setTransparency(const float value) = 0;
			virtual float getTransparency() const = 0;
			virtual Size getSize() const = 0;
			virtual void setSize(const Size &newSize) = 0;
			virtual void setScale(const Size &newScale) = 0;
			virtual Size getScale() const = 0;
			virtual bool contains(const Position &pos) const = 0;
			inline void setCastShadowState(const bool enable)	{mDoCastShadow = enable;}
			inline bool canCastShadow() const					{return mDoCastShadow && isVisible();}

			Size getExactSize() const;
			void stretch(const Position &begin, const Position &end);

			inline static void Init(Factory *f)
			{
				if(msFactory)
					delete msFactory;
				msFactory = f;
			}
			static Sprite* Create(const char *spriteName);
		protected:
			inline Sprite()
				: mDoCastShadow(true)
			{}

			static Factory*	msFactory;
		private:
			bool	mDoCastShadow;
	};
}

#endif // __GlSprite_h__
